package com.alan.product.issue.controller;

import com.alan.product.issue.entity.ItemWarehouses;
import com.alan.product.issue.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("item")
public class ItemController {

    @Autowired
    private ItemService itemService;

    @PostMapping("editItem")
    public String editItemName(Long id, String name) {
        return itemService.editItem(id, name);
    }

    @PostMapping("updateCount")
    public String updateCount(Long id, Integer count) {
        return itemService.updateCount(id, count);
    }

    @PostMapping("export")
    public String export(Long[] idList) {
        System.out.println("export");
        return "success";
    }

    @PostMapping("editItemWarehouses")
    public String editItemWarehouses(@RequestBody ItemWarehouses itemWarehouses) {
        itemService.editItemWarehouses(itemWarehouses);
        return "success";
    }
}
